package com.bestv.database.vo;

import java.io.Serializable;

/**
 * Created by Henry on 14-6-12.
 */
public abstract class Base implements Serializable {
    protected Long id;
    protected String mediaCode;

    public boolean isValid() {
        return id != null && mediaCode != null;
    }

    public String getCacheIdKey() {
        return String.format("%s-Id-%s", getClass().getSimpleName(), id);
    }

    public String getCacheMediaCodeKey() {
        return String.format("%s-MediaCode-%s", getClass().getSimpleName(), mediaCode);
    }

    public String getCacheMediaCodeKey(Integer itemVersion, Integer hdsdType) {
        return String.format("%s-MediaCode-%s-ItemVersion-%s-HdsdType-%s", getClass().getSimpleName(), mediaCode, itemVersion, hdsdType);
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getMediaCode() {
        return mediaCode;
    }

    public void setMediaCode(String mediaCode) {
        this.mediaCode = mediaCode;
    }
}
